using IQIGame.Onigao.Framework;
using IQIGame.Onigao.Game;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay
{
    public class UICommonImageItem : UIBaseNode
    {

        #region Template Generate,don't modify
        protected partial class UIB_UICommonImageItem
        {
            #region ObjectBinding Generate
            public IQIGame.Onigao.Framework.ExImage Image { protected set; get; }
            protected virtual void InitBinding(ObjectBinding __binding)
            {
                __binding.TryGetVariableValue<IQIGame.Onigao.Framework.ExImage>("Image", out var __tbv0);
                this.Image = __tbv0;
            }
            #endregion ObjectBinding Generate 
        }
        #endregion Template Generate,don't modify

        /// <summary>
        /// 可以自定义修改的
        /// </summary>
        protected partial class UIB_UICommonImageItem
        {
            public virtual void StartBinding(GameObject __go)
            {
                var binding = __go.GetComponent<ObjectBinding>();
                if (binding != null)
                {
                    this.InitBinding(binding);
                }
            }
        }
        protected UIB_UICommonImageItem ui { get; set; }

        protected override void BeforeInit()
        {
            ui = new UIB_UICommonImageItem();
            ui.StartBinding(gameObject);
        }

        protected override void OnInit()
        {

        }

        protected override void OnShow()
        {

        }

        protected override void OnHide()
        {

        }

        protected override void OnDispose()
        {

        }

        public void SetSprite(Sprite sprite)
        {
            this.ui.Image.sprite = sprite;
        }
    }
}